<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- 题目描述：制作一个函数，getDayNum( 年月日日期 )，可以返回指定日期是当前年的第几天

	例：  getDayNum( “2019-1-2”)    返回值为：2 -->


</body>
<script>
    function getDayNum(date) {
        var a = new Date(date)
        // var year=date.getFullYear()
        var year = a.getFullYear();
        var c =year+'-1-1'
         a = +new Date(date)
        var now = +new Date(c)
        var b = a - now
        var day=parseInt(b/1000/60/60/24)+1
        return [year,day]
    }
    var inputTime=prompt('请输入当前的日期')
    var day = getDayNum(inputTime);
    alert(`现在是${day[0]}年的第${day[1]}天`)
</script>

</html>